#include "TcpServer.hpp"
#include "TcpConnection.hpp"
#include <iostream>
#include <unistd.h>
using std::cout;
using std::endl;

namespace wd{


TcpServer::TcpServer(int port, string ip)
:_accptor(port,ip)
,_eventloop(_accptor)
{

}
    
void TcpServer::start(){
    _eventloop.loop();
}

void TcpServer::stop(){
    _eventloop.unloop();
}

void TcpServer::setAllCallbacks(CallBack _onNewconn,
                         CallBack _onMessage,
                         CallBack _onClose)
{
    _eventloop.setAllCallbacks(_onNewconn,_onMessage,_onClose);
}

}

